package com.demo.controller;

import com.demo.domain.User;
import com.demo.service.impl.login.JavaMailutil;
import com.demo.service.impl.login.LoginServiceImpl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import redis.clients.jedis.Jedis;

@RestController
@RequestMapping("codeLogin")
public class Login {

    @Autowired
    LoginServiceImpl loginService;
    //登录
    //shu(手机号,邮箱) verificationcode 验证码
    @GetMapping("loginCode")
    public User login(String shu, int verificationcode) {
     return loginService.login(shu,verificationcode);
    }


    //点击获取验证码 按钮事件  发送验证码到邮箱.
    //将手机号(邮箱) 验证码,加入redis,然后设置过期时间为15分钟
    @GetMapping("code")
    public void code(String shu) {
        loginService.code(shu);

    }


}
